home *** CD-ROM | disk | FTP | other *** search
/ Aminet 46 / Aminet 46 (2001)(GTI - Schatztruhe)[!][Dec 2001].iso / Aminet / text / edit / edt10src.lha / txt / Keymapping.mod < prev    next >
Text File  |  1995-04-09  |  2KB  |  82 lines

  1. (*
  2.   .name         RxKeymapping
  3.   .task         keymapping with arexx
  4.   .release      1.0
  5.   .language     Oberon-2
  6.   .translator   Amiga Oberon 3.2
  7.   .system req.  AmigaOS 2.04 or higher
  8.   .author       Joachim Barheine
  9.   .address      Hochgrevestr. 3
  10.   .copyright    (c) 1995 by J.Barheine
  11. *)
  12.  
  13. (* .info: 28/03/95, 17:33:00, version 2 *)
  14.  
  15. MODULE Keymapping;
  16.  
  17. IMPORT
  18.   ASCII,
  19.  
  20.   CN:= CmdNodes,
  21.   IO:= IOServer,
  22.   K:= Kernel,
  23.   Rx:= ERexx,
  24.   S:= Strings,
  25.   Str:= StrPool,
  26.   T:= Texts,
  27.   W:= Windows;
  28.  
  29. VAR
  30.   keyInfo: K.DynArray;
  31.  
  32. PROCEDURE* DoKey(w: IO.Window; id: INTEGER): SHORTINT;
  33.  
  34. VAR
  35.   n: CN.CmdNode;
  36.   t: IO.Text;
  37.  
  38. BEGIN
  39.   n:= keyInfo.Get(id)(CN.CmdNode);
  40.   IF CN.ExecRexx(w(W.Window), n.string^, n.isFile) THEN
  41.     IF n.global THEN t:= NIL ELSE t:= w.text END;
  42.     IO.ToggleItem(t, n.itemID);
  43.     RETURN CN.HandleRexx(w(W.Window));
  44.   ELSE
  45.     RETURN IO.msgLocal;
  46.   END;
  47. END DoKey;
  48.  
  49. PROCEDURE SetRawKey* (code: INTEGER; qual: SHORTSET; cmdStr: ARRAY OF CHAR;
  50.                       isFile: BOOLEAN; itemID: INTEGER; global: BOOLEAN);
  51.  
  52. VAR
  53.   str: K.DynString;
  54.  
  55. (* $CopyArrays- *)
  56.  
  57. BEGIN
  58.   NEW(str, S.Length(cmdStr) + 1);
  59.   COPY(cmdStr, str^);
  60.   keyInfo.Put(CN.CreateNode(str, itemID, isFile, global),
  61.               IO.SetRawKey(code, qual, DoKey));
  62. END SetRawKey;
  63.  
  64. PROCEDURE SetANSIKey* (c: CHAR; qual: SHORTSET; cmdStr: ARRAY OF CHAR;
  65.                        isFile: BOOLEAN; itemID: INTEGER; global: BOOLEAN);
  66.  
  67. VAR
  68.   str: K.DynString;
  69.  
  70. (* $CopyArrays- *)
  71.  
  72. BEGIN
  73.   NEW(str, S.Length(cmdStr) + 1);
  74.   COPY(cmdStr, str^);
  75.   keyInfo.Put(CN.CreateNode(str, itemID, isFile, global),
  76.               IO.SetANSIKey(c, qual, DoKey));
  77. END SetANSIKey;
  78.  
  79. BEGIN
  80.   keyInfo.New(20, 10);
  81. END Keymapping.
  82.